package com.shd.edanpei.ui.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.TextView;

import com.shd.edanpei.R;
import com.shd.edanpei.base.BaseActivity;
import com.shd.edanpei.common.Constant;
import com.shd.edanpei.bean.MeNeedModel;
import com.shd.edanpei.presenter.contract.NeedDetailsContract;
import com.shd.edanpei.presenter.NeedDetailsPresenter;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by mc on 2018/10/18.
 * yang-wen-wen
 */

public class NeedDetailsActivity extends BaseActivity<NeedDetailsPresenter> implements NeedDetailsContract.NeedDetailsIView {

    @BindView(R.id.headline)
    TextView headline;
    @BindView(R.id.tv_industry)
    TextView tvIndustry;
    @BindView(R.id.tv_needProduct)
    TextView tvNeedProduct;
    @BindView(R.id.tv_describe)
    TextView tvDescribe;

    @Override
    protected int setLayout() {
        return R.layout.activity_need_details;
    }

    @Override
    protected NeedDetailsPresenter bindPresenter() {
        return new NeedDetailsPresenter(this);
    }

    @Override
    protected void initView(@Nullable Bundle savedInstanceState) {
        headline.setText("需求详情");
        Bundle bundle = getIntent().getExtras();
        int id = bundle.getInt(Constant.ID);
        mPresenter.getData(id);
    }

    @Override
    protected void initListener() {

    }

    @OnClick(R.id.iv_headline_back)
    void onBack() {
        finish();
    }

    @Override
    public void setData(MeNeedModel model) {
        tvIndustry.setText(model.getIndustrySelect());
        tvNeedProduct.setText(model.getNeedProduct());
        tvDescribe.setText(model.getRemark());
    }
}
